import { getToken } from '@/utils/tokenUtil';
import { ReactElement } from 'react';
import { Navigate } from 'react-router-dom';

// 鉴权路由组件
const AuthRoute = ({ children }: { children: ReactElement }) => {
    const token = getToken();
    if (token) {
        return children;
    } else {
        return (<Navigate to='/login' replace />);
    }
};

export default AuthRoute;